package com.yqjr.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class SchedulerTask {

	    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

	    @Scheduled(fixedRate = 6000)
	    public void reportCurrentTime() {
	        for (int i = 0; i < 10; i++) {
	        	System.out.println("reporter1-现在时间：" + i + "-" + dateFormat.format(new Date()));
			}
	    }
	    
	    @Scheduled(fixedRate = 6000)
	    public void reportCurrentTime2() {
	    	for (int i = 0; i < 10; i++) {
	    		System.out.println("report2-现在时间：" + i + "-" + dateFormat.format(new Date()));
	    	}
	    }
	}
